import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class readerServices extends JFrame {
	private JButton search;
	private JTextField text1, text2, text3, text4;
	private JLabel label1, label2, label3, label4;
	private JMenuBar menubar;
	private JMenu option;
	private JMenuItem exit, discharge, issue, renew;
	static String id, email, lname, fname, combine;

	readerServices() {
		setLayout(new FlowLayout());

		menubar = new JMenuBar();
		setJMenuBar(menubar);

		option = new JMenu("Options");
		menubar.add(option);

		issue = new JMenuItem("Issue");
		option.add(issue);

		discharge = new JMenuItem("Discharge");
		option.add(discharge);

		renew = new JMenuItem("Renew");
		option.add(renew);

		exit = new JMenuItem("Exit");
		option.add(exit);
		// above are the items in menu

		// search options
		label1 = new JLabel("User ID      ");
		add(label1);

		text1 = new JTextField(10);
		add(text1);

		label2 = new JLabel("E-mail        ");
		add(label2);

		text2 = new JTextField(10);
		add(text2);

		label3 = new JLabel("Last name");
		add(label3);

		text3 = new JTextField(10);
		add(text3);

		label4 = new JLabel("First name");
		add(label4);

		text4 = new JTextField(10);
		add(text4);

		search = new JButton("Search");
		add(search);

		event e = new event();
		search.addActionListener(e);

		event1 e1 = new event1();
		exit.addActionListener(e1);

	}

	public class event implements ActionListener {

		public void actionPerformed(ActionEvent e) {

			id = text1.getText().toLowerCase();
			email = text2.getText().toLowerCase();
			lname = text3.getText().toLowerCase();
			fname = text4.getText().toLowerCase();

			combine = id + " " + email + " " + lname + " a" + fname;

			popWindow app1 = new popWindow(readerServices.this);
			app1.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
			app1.setSize(300, 100);
			app1.setLocation(200, 200);
			app1.setVisible(true);

		}

	}

	/*
	 * class event implements ActionListener {
	 * 
	 * public void actionPerformed(ActionEvent e) { try { guess = (int)
	 * (Double.parseDouble(text1.getText()));
	 * label1.setText("Context should be displayed here"); } catch (Exception
	 * ex) { label1.setText("invalid key"); }
	 * 
	 * }
	 * 
	 * }
	 */

	public class event1 implements ActionListener {

		public void actionPerformed(ActionEvent e1) {
			System.exit(0);
		}

	}

	public static void main(String args[]) {
		readerServices app = new readerServices();
		app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		app.setVisible(true);
		app.setSize(220, 200);
		app.setTitle("Reader Services");
	}

}
